import { Provide } from '@midwayjs/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { User } from '../entity/user.entity';
import { Repository } from 'typeorm';

@Provide()
export class UserRepository {

    @InjectEntityModel(User)
    userModel: Repository<User>;

    async findByUsername(username: string) {
        console.log(username);
        return this.userModel.findOneBy({ username: username })
    }
}